﻿Public Class frmPrincipal

#Region "Funções"

    Private Sub ConfigurarTextos()

        tsmiChampions.Text = Resources.RetornarTextos("MenuChampions")
        tsmiSimulacao.Text = Resources.RetornarTextos("MenuSimulacao")
        tsmiItem.Text = Resources.RetornarTextos("MenuItens")
        tsmiRunas.Text = Resources.RetornarTextos("MenuRunas")
        tsmiPlayerSpells.Text = Resources.RetornarTextos("MenuPlayerSpells")
        tsmiMasterias.Text = Resources.RetornarTextos("MenuMasteries")
        tsmiAjuda.Text = Resources.RetornarTextos("MenuAjuda")
        tsmiIdiomas.Text = Resources.RetornarTextos("MenuIdiomas")

        tsmiSimulacaoChampionStats.Text = Resources.RetornarTextos("SubMenuSimulacaoChampionStats")
        tsmiChampionVisualizar.Text = Resources.RetornarTextos("SubMenuChampionVisualizar")
        tsmiItemVisualizar.Text = Resources.RetornarTextos("SubMenuItemVisualizar")
        tsmiAjudaSobre.Text = Resources.RetornarTextos("SubMenuAjudaSobre")
        tsmiAjudaComoUtilizar.Text = Resources.RetornarTextos("SubMenuAjudaComoUtilizar")

    End Sub

    Private Sub ConfigurarTextosJanelasFilhas()

        Dim lisFormsChildren As System.Windows.Forms.Form() = Me.MdiChildren

        For i As Integer = 0 To lisFormsChildren.Count - 1

            Dim typeForm As System.Type = lisFormsChildren(i).GetType

            Dim objForm = CTypeDynamic(lisFormsChildren(i), typeForm)

            objForm.ConfigurarTextos()

        Next

    End Sub

#End Region

#Region "Eventos"

    Private Sub tmrData_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrData.Tick

        lblData.Text = Now

    End Sub

    Private Sub fmrPrincipal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ConfigurarTextos()

    End Sub

    Private Sub VisualizarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmiChampionVisualizar.Click
        frmSelecaoChampion.MdiParent = Me
        frmSelecaoChampion.Show()
    End Sub

    Private Sub ConfigurarIdioma(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PortuguêsptBRToolStripMenuItem.Click, EnglishEnUSToolStripMenuItem.Click

        Dim tsmIdioma As ToolStripMenuItem = TryCast(sender, ToolStripMenuItem)

        Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(Convert.ToString(tsmIdioma.Tag))
        Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo(Convert.ToString(tsmIdioma.Tag))

        ConfigurarTextos()

        ConfigurarTextosJanelasFilhas()

    End Sub

    Private Sub tsmiAjudaSobre_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmiAjudaSobre.Click
        frmSobre.Show()
    End Sub

    Private Sub tsmiSimulacaoChampionStats_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmiSimulacaoChampionStats.Click
        frmSimulacaoStats.MdiParent = Me
        frmSimulacaoStats.Show()
    End Sub

    Private Sub tsmiItemVisualizar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmiItemVisualizar.Click
        frmSelecaoItem.MdiParent = Me
        frmSelecaoItem.Show()
    End Sub

#End Region

End Class